//
//  HNSNGetMoneyDetailTC.m
//  ZYManagementSystem
//
//  Created by 星道 on 17/6/15.
//  Copyright © 2017年 焕宁. All rights reserved.
//

#import "HNSNGetMoneyDetailTC.h"

@implementation HNSNGetMoneyDetailTC
{
    IBOutlet UILabel *_PayTime;
    IBOutlet UILabel *_FamilyName;
    IBOutlet UILabel *_Desc;
    IBOutlet UILabel *_Money;
    IBOutlet UIImageView *_RedCycle;
}



- (instancetype (^)(HNSNGetMoneyModel *))Model {

    return ^(HNSNGetMoneyModel *Model) {


        // 是否清除小红点
        _RedCycle.hidden = [Model.isViewed isEqualToNumber:@(0)]?YES:NO;

        //价格
        if (Model.canWithdrawCoins) {
            // 星币类提现
            [self Coins:Model];

        } else {

            // 资金类提现
            [self Money:Model];
        }
        return self;
    };
}


/**
 提现状态 -1：未提现或暂不可提现 0：提现中，1：财务拒绝，2：财务同意，3：终审拒绝，4：终审同意，5：已结算 Type:0课程结算 1佣金金额
 当状态为-1时，判断Type的值，0显示未提现 1的话根据 num 值 ，2为未提现，1为暂不可提现
 */
- (NSString *)GetStrForIndex:(NSInteger)Index Type:(NSInteger)Type Num:(NSInteger)Num
{
    switch (Index)
    {
            //Index为-1
        case -1:
        {
            if (Type == 0)
            {
                return @"未提现";
            }
            else
            {
                if (Num == 2)
                {
                    return @"未提现";
                }
                else
                {
                    return @"暂不可提现";
                }
            }
        };break;
        case 0:return @"提现中";break;
        case 1:return @"财务拒绝";break;
        case 2:return @"财务同意";break;
        case 3:return @"终审拒绝";break;
        case 4:return @"终审同意";break;
        case 5:return @"已提现";break;
        default:return @"未知";break;
    }
}











// 资金类提现
- (void)Money:(HNSNGetMoneyModel *)Model {
    //价格
    if ([Model.type isEqualToNumber:@0])
    {
        // 价格显示
        if (Model.courseName == nil && Model.payTime.length > 0)
        {
            _Money.text = [NSString stringWithFormat:@"+%.2f(%@)",[Model.settlementPrice floatValue],[self GetStrForIndex:[Model.withdrawFlag integerValue] Type:[Model.type integerValue] Num:[Model.num integerValue]]];
            _Desc.text = Model.T_Name?:@"";
            _FamilyName.text = Model.B_petName?:@"";
            _PayTime.text = Model.payTime?:@"";
        }
        else
        {
            _Money.text = [NSString stringWithFormat:@"+%.2f(%@)",[Model.actualPaid floatValue],[self GetStrForIndex:[Model.withdrawFlag integerValue] Type:[Model.type integerValue] Num:[Model.num integerValue]]];//金额
            _Desc.text = Model.courseName;//描述
            _FamilyName.text = Model.payName;//付款人
            _PayTime.text = Model.tradeTime;//时间

        }
    }
    else
    {
        //佣金金额
        Log(@"%@",[Model.actualPaid stringValue]);
        _FamilyName.text = Model.B_petName;
        _PayTime.text = Model.payTime;
        _Money.text = [NSString stringWithFormat:@"+%.2f(%@)",[Model.commissionMoney floatValue],[self GetStrForIndex:[Model.withdrawFlag integerValue] Type:[Model.type integerValue] Num:[Model.num integerValue]]];
        _Desc.text = Model.C_name;
    }
}



- (void)Coins:(HNSNGetMoneyModel *)Model {

    _Money.text = [NSString stringWithFormat:@"+%.2f(%@)",[Model.coins floatValue],[self GetStrForIndex:[Model.withdrawFlag integerValue] Type:[Model.type integerValue] Num:[Model.num integerValue]]];//金额
    _Desc.text = Model.courseName;//描述
    _FamilyName.text = Model.payName;//付款人
    _PayTime.text = Model.tradeTime;//时间
}
@end
